package com.hnevc.acountms.dao;

import com.hnevc.acountms.model.Tb_flag;

import org.litepal.crud.DataSupport;

import java.util.List;

/**
 * Created by Administrator on 2017/9/28.
 */

public class FlagDao extends DataSupport {
    public void add(Tb_flag flag){
        flag.save();
    }
    public void update(Tb_flag flag){
        flag.save();
    }
    public Tb_flag find(int id){
        Tb_flag tb_flag = DataSupport.find(Tb_flag.class, id);
        return tb_flag;

    }
    public void delete(int... ids){
        for(int i=0;i<ids.length;i++) {
            DataSupport.deleteAll(Tb_flag.class, "id=?", ids[i]+"");
        }
    }
    public List<Tb_flag> getScrollData(int start,int count){
        List<Tb_flag> flags = DataSupport.limit(count)
                .offset(start)
                .find(Tb_flag.class);
        return flags;

    }
    public long getCount(){
        int count = DataSupport.count(Tb_flag.class);
        return count;
    }
    public int getMaxId(){
        int id = DataSupport.max(Tb_flag.class, "id", int.class);
        return id;

    }
}
